<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/* CRM in Job Order */
class Crm extends Controller {
	
	function Crm(){
		if(!$this->session->userdata('user_id')){
			redirect($this->config->item('auth'));
		}
        if(!$this->session->userdata('menu3')==1){
			redirect($this->config->item('dashboard'));
		}
        $this->load->model('jobs');
        $this->load->model('products');
        $this->load->model('participants');
        $this->load->model('banks');
        $this->load->model('facilitas');
	}
	
	function index(){
		if( ($this->session->userdata('user_group')== $this->config->item('admin')) || ($this->session->userdata('user_group')== $this->config->item('co_admin')) ):
            $add 				= $this->lang->line('add');
			$adv_search 		= $this->lang->line('adv_search');
			$add_link 			= $this->config->item('job_add');
			$adv_search_link    = $this->config->item('job_search');
			$add_active 		= $this->config->item('empty');
			$adv_search_active  = $this->config->item('empty');
            
            $app 		        = "";
            $app_link 			= "";
            $app_active 		= ""; 
            
            $target             = $this->lang->line('target');
            $target_link 	    = $this->config->item('job_target');
            $target_active      = $this->config->item('empty');
            
       elseif(($this->session->userdata('user_pos')== $this->config->item('ta')) || ($this->config->item('se') == $this->session->userdata('user_pos')) ||($this->config->item('ae') == $this->session->userdata('user_pos')) ):
            $add 		        = $this->lang->line('add'); 
			$add_link 	        = $this->config->item('job_add');
			$add_active	        = $this->config->item('empty');
            
            $app 		        = "";
            $app_link 			= "";
            $app_active 		= ""; 
            
            $adv_search 		= ""; 
			$adv_search_link 	= "";
			$adv_search_active	= "";
            
            $target             = "";
            $target_link 	    = "";
            $target_active      = "";
            
        elseif(($this->session->userdata('user_pos')== $this->config->item('spv')) || ($this->config->item('mgr') == $this->session->userdata('user_pos')  ) || ($this->config->item('keu') == $this->session->userdata('user_pos')  ) ) :
          
            $add 		        = ""; 
			$add_link 	        = "";
			$add_active	        = "";
            if($this->session->userdata('user_group')== $this->config->item('manage')):  
                $app 		        = $this->lang->line('app');
                $app_link 			= $this->config->item('job_app');
                $app_active 		= $this->config->item('empty');
            else:
                $app 		        = "";
                $app_link 			= "";
                $app_active 		= "";      
            endif;
            $adv_search 		= ""; 
			$adv_search_link 	= "";
			$adv_search_active	= "";
            
            $target             = "";
            $target_link 	    = "";
            $target_active      = "";
            
        elseif(($this->session->userdata('user_group')== $this->config->item('prod')) ) :
            $add 		        = ""; 
			$add_link 	        = "";
			$add_active	        = "";
            
            $app 		        = "";
            $app_link 			= "";
            $app_active 		= ""; 
            
            $adv_search 		= ""; 
			$adv_search_link 	= "";
			$adv_search_active	= "";
            
            $target             = "";
            $target_link 	    = "";
            $target_active      = "";    
                    
        else:
            $add 		        = ""; 
			$add_link 	        = "";
			$add_active	        = "";
			
			$adv_search 		= ""; 
			$adv_search_link 	= "";
			$adv_search_active	= "";
            
            $app 		        =""; 
			$app_link 	        ="";
			$app_active	        ="";
            
            $target             = "";
            $target_link 	    = "";
            $target_active      = "";
            
        endif;
        
        if($this->session->userdata('user_pos')== $this->config->item('ta')):
                    $access = $this->config->item('ta');
        elseif($this->session->userdata('user_pos')== $this->config->item('se')):
                    $access = $this->config->item('se');
		elseif($this->session->userdata('user_pos')== $this->config->item('ae')):
                    $access = $this->config->item('ae');			
        else:
                    $access = "";               
        endif;      
		
		$data = array(
                        'title'		=>	$this->lang->line('job'),
                        'table'     =>  array
                                             (
                                                'jobs'              =>  $this->jobs->getAll()
                                             ),
                        'access'    =>  $access,                     
						'content'	=> 	'list',
						'menu' 		=> 	array(
												'dashboard_active'	=>	$this->config->item('empty'),
												'contact_active'	=>	$this->config->item('empty'),
                                                'contactdna_active'	=>	$this->config->item('empty'),
												'activity_active'	=>	$this->config->item('empty'),
												'job_active'		=>	$this->config->item('active'),
												'call_active'		=>	$this->config->item('empty'),
												'user_active'		=>	$this->config->item('empty'),
												'report_active'		=>	$this->config->item('empty'),
												'master_active'		=>	$this->config->item('empty'),
												'graphic_active'	=>	$this->config->item('empty'),
												'setting_active'	=>	$this->config->item('empty'),
											 ),
						'tab'		=>	array(
												'tab1'				=>	$this->lang->line('list'),
												'tab1_link'			=>	$this->config->item('job'),
												'tab1_active'		=>	$this->config->item('active'),
                                                'tab2'				=>	$add,
												'tab2_link'			=>	$add_link,
												'tab2_active'		=>	$add_active,
                                                'tab3'				=>	$adv_search,
												'tab3_link'			=>	$adv_search_link,
												'tab3_active'		=>	$add_active,
												'tab4'				=>	$app,
                                                'tab4_link'			=>	$app_link,
												'tab4_active'		=>	$app_active,
												'tab5'				=>	$target,
                                                'tab5_link'			=>	$target_link,
												'tab5_active'		=>	$target_active,
												'tab6'				=>	$this->lang->line('pb'),
                                                'tab6_link'			=>	$this->config->item('job_pb'),
												'tab6_active'		=>	$this->config->item('empty'),
												'tab7'				=>	'',
												'tab8'				=>	''
											 )				
					 );
		$this->load->vars($data);
		$this->load->theme('default');
	}
    
    function addnew(){
	    /*if($this->session->userdata('user_group')!= $this->config->item('admin') ){
            redirect($this->config->item('job'));
        }*/
        if(($this->session->userdata('user_pos')== $this->config->item('ta')) || ($this->session->userdata('user_pos')== $this->config->item('ae')) || ( $this->config->item('se') == $this->session->userdata('user_pos') ) || ($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') ) ):
           	
    		if( ($this->session->userdata('user_group')== $this->config->item('admin')) || ($this->session->userdata('user_group')== $this->config->item('co_admin')) ) :
                $add 				= $this->lang->line('add');
    			$adv_search 		= $this->lang->line('adv_search');
    			$add_link 			= $this->config->item('job_add');
    			$adv_search_link    = $this->config->item('job_search');
    			$add_active 		= $this->config->item('empty');
    			$adv_search_active  = $this->config->item('empty');
                
                $target             = $this->lang->line('target');
                $target_link 	    = $this->config->item('job_target');
                $target_active      = $this->config->item('empty');
            
            else:
                $add 		        = ""; 
    			$add_link 	        = "";
    			$add_active	        = "";
    			$adv_search 		= ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";
                
                $target             = "";
                $target_link 	    = "";
                $target_active      = "";
            endif; 
               
    		$data = array(
    						'title'		=>	$this->lang->line('add'),
    						'table'		=>	array(
    												'products'			=>	$this->products->getActive(),
                                                    'banks'		       	=>	$this->banks->getActive(),
                                                    'participants'      =>  $this->participants->getActive(),
                                                    'facilitas'		    =>	$this->facilitas->getActive(),
                                                    'value'             =>  "",
                                                    'customers'         =>  $this->jobs->getCustomer()
    											 ),
                            'form'      =>  array('action'=>$this->config->item('job_save')),                     
    						'content'	=> 	'form',
    						'menu' 		=> 	array(
    												'dashboard_active'	=>	$this->config->item('empty'),
    												'contact_active'	=>	$this->config->item('empty'),
                                                    'contactdna_active'	=>	$this->config->item('empty'),
    												'activity_active'	=>	$this->config->item('empty'),
    												'job_active'		=>	$this->config->item('active'),
    												'call_active'		=>	$this->config->item('empty'),
    												'user_active'		=>	$this->config->item('empty'),
    												'report_active'		=>	$this->config->item('empty'),
    												'master_active'		=>	$this->config->item('empty'),
    												'graphic_active'	=>	$this->config->item('empty'),
    												'setting_active'	=>	$this->config->item('empty'),
    											 ),
    						'tab'		=>	array(
    												'tab1'				=>	$this->lang->line('list'),
    												'tab1_link'			=>	$this->config->item('job'),
    												'tab1_active'		=>	$this->config->item('empty'),
    												'tab2'				=>	$this->lang->line('add'),
    												'tab2_link'			=>	$this->config->item('job_add'),
    												'tab2_active'		=>	$this->config->item('active'),
    												'tab3'				=>	$adv_search,
    												'tab3_link'			=>	$adv_search_link,
    												'tab3_active'		=>	$adv_search_active,
    												'tab4'				=>	$target,
                                                    'tab4_link'			=>	$target_link,
    												'tab4_active'		=>	$target_active,
    												'tab5'				=>	'',
    												'tab6'				=>	$this->lang->line('pb'),
                                                    'tab6_link'			=>	$this->config->item('job_pb'),
												    'tab6_active'		=>	$this->config->item('empty'),
    												'tab7'				=>	'',
    												'tab8'				=>	''
    											 )			
    					 );
    		$this->load->vars($data);
    		$this->load->theme('default');
        else:
            redirect($this->config->item('job'));
        endif;
	}
    
    function savejob(){
        if(($this->session->userdata('user_pos')== $this->config->item('ta')) || ($this->session->userdata('user_pos')== $this->config->item('ae')) || ($this->session->userdata('user_pos')== $this->config->item('ae'))  || ( $this->config->item('se') == $this->session->userdata('user_pos') ) || ($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') ) ):
           
            if($this->input->post('save')):
                //$val=count($this->jobs->getCek());
                //if($val<1):
                    $this->jobs->getSave();
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success </strong>message - '.$this->lang->line('m_save').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
                //else:
                 //   $this->session->set_flashdata('message','<span class="message error"><strong>Success</strong>message - '.$this->lang->line('m_duplicate').'  </span>');
                 //   redirect($this->input->server('HTTP_REFERER'));
                //endif;
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
     }   
    
    function saveproduct(){
        if(($this->session->userdata('user_group')== $this->config->item('admin')) ||  ($this->session->userdata('user_group')== $this->config->item('co_admin'))):
            
            if($this->input->post('save')):
                $val=count($this->products->getCek());
                if($val<1):
                    $this->products->getSave();
                    $this->session->set_flashdata('message2','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_save').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
                else:
                    $this->session->set_flashdata('message2','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_duplicate').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
                endif;
            endif;
        else:
        redirect($this->config->item('job'));
        endif;
    }
    
    function updateproduct(){
       if(($this->session->userdata('user_group')== $this->config->item('admin')) ||  ($this->session->userdata('user_group')== $this->config->item('co_admin'))):
           
            if($this->input->post('save')):
                    $this->products->getUpdate();
                    $this->session->set_flashdata('message2','<span class="message success"><strong>Succes </strong>message - '.$this->lang->line('m_update').'  </span>');                     
            elseif($this->input->post('delete')):  
                    $this->products->getRemove();    
                    $this->session->set_flashdata('message2','<span class="message success"><strong>Succes </strong>message - '.$this->lang->line('m_delete').'  </span>');     
            endif;
            redirect($this->input->server('HTTP_REFERER'));
        else:
            redirect($this->config->item('job'));
        endif; 
    }
    
    function savebank(){
        if(($this->session->userdata('user_group')== $this->config->item('admin')) ||  ($this->session->userdata('user_group')== $this->config->item('co_admin'))):
          
            if($this->input->post('save')):
                $val=count($this->banks->getCek());
                if($val<1):
                    $this->banks->getSave();
                    $this->session->set_flashdata('message3','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_save').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
                else:
                    $this->session->set_flashdata('message3','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_duplicate').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
                endif;
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function updatebank(){
       if(($this->session->userdata('user_group')== $this->config->item('admin')) ||  ($this->session->userdata('user_group')== $this->config->item('co_admin'))):
          
            if($this->input->post('save')):
                    $this->banks->getUpdate();
                    $this->session->set_flashdata('message3','<span class="message success"><strong>Succes </strong>message - '.$this->lang->line('m_update').'  </span>');                     
                 
            elseif($this->input->post('delete')):  
                    $this->banks->getRemove();    
                    $this->session->set_flashdata('message3','<span class="message success"><strong>Succes </strong>message - '.$this->lang->line('m_delete').'  </span>');     
            endif;
            redirect($this->input->server('HTTP_REFERER')); 
       else:
            redirect($this->config->item('job'));
       endif;  
    }
	
	function saveparticipant(){
        if(($this->session->userdata('user_group')== $this->config->item('admin')) ||  ($this->session->userdata('user_group')== $this->config->item('co_admin'))):
          
            if($this->input->post('save')):
                $val=count($this->participants->getCek());
                if($val<1):
                    $this->participants->getSave();
                    $this->session->set_flashdata('message4','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_save').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
                else:
                    $this->session->set_flashdata('message4','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_duplicate').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
                endif;
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function updateparticipant(){
       if(($this->session->userdata('user_group')== $this->config->item('admin')) ||  ($this->session->userdata('user_group')== $this->config->item('co_admin'))):
          
            if($this->input->post('save')):
                    $this->participants->getUpdate();
                    $this->session->set_flashdata('message4','<span class="message success"><strong>Succes </strong>message - '.$this->lang->line('m_update').'  </span>');                     
                 
            elseif($this->input->post('delete')):  
                    $this->participants->getRemove();    
                    $this->session->set_flashdata('message4','<span class="message success"><strong>Succes </strong>message - '.$this->lang->line('m_delete').'  </span>');     
            endif;
            redirect($this->input->server('HTTP_REFERER')); 
       else:
            redirect($this->config->item('job'));
       endif;  
    }

	function view($id)
	{
	    /*if($this->session->userdata('user_group')!= $this->config->item('admin') ){
            redirect($this->config->item('job'));
        }*/
       if(($this->session->userdata('user_pos')== $this->config->item('ta')) || ($this->session->userdata('user_pos')== $this->config->item('ae')) || ( $this->config->item('se') == $this->session->userdata('user_pos') ) || ($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') ) || ($this->session->userdata('user_group')== $this->config->item('manage') ) || ($this->session->userdata('user_group')== $this->config->item('prod') ) ):
           	
            if(!$id){
                $this->session->set_flashdata('message','<span class="message error"><strong>Error</strong>message - '.$this->lang->line('m_wrong').'  </span>');    
                redirect($this->config->item('job'));
            }
               
    		$data = array(
    						'title'		=>	$this->lang->line('view'),
    						'table'		=>	array(
                                                    'value'				=>	$this->jobs->getData($id),
                                                    'products'			=>	$this->products->getActive(),
                                                    'banks'		       	=>	$this->banks->getActive(),
                                                    'participants'      =>  $this->participants->getActive(),
                                                    'facilitas'		    =>	$this->facilitas->getActive(),
                                                    'fac'				=>	$this->jobs->getJobFac($id),
    												'par'				=>	$this->jobs->getJobParticipant($id),
                                                    'customers'         =>  $this->jobs->getCustomer()
    											 ),
                            'form'      =>  array('action'=>$this->config->item('job_update')),                     
    						'content'	=> 	'form',
    						'menu' 		=> 	array(
    												'dashboard_active'	=>	$this->config->item('empty'),
    												'contact_active'	=>	$this->config->item('empty'),
    												'contactdna_active'	=>	$this->config->item('empty'),
                                                    'activity_active'	=>	$this->config->item('empty'),
    												'job_active'		=>	$this->config->item('active'),
    												'call_active'		=>	$this->config->item('empty'),
    												'user_active'		=>	$this->config->item('empty'),
    												'report_active'		=>	$this->config->item('empty'),
    												'master_active'		=>	$this->config->item('empty'),
    												'graphic_active'	=>	$this->config->item('empty'),
    												'setting_active'	=>	$this->config->item('empty'),
    											 ),
    						'tab'		=>	array(
    												'tab1'				=>	$this->lang->line('list'),
    												'tab1_link'			=>	$this->config->item('job'),
    												'tab1_active'		=>	$this->config->item('empty'),
    												'tab2'				=>	$this->lang->line('add'),
    												'tab2_link'			=>	$this->config->item('job_add'),
    												'tab2_active'		=>	$this->config->item('empty'),
    												'tab3'				=>	$this->lang->line('view'),
                                                    'tab3_link'			=>	$this->config->item('job_view').$id,
    												'tab3_active'		=>	$this->config->item('active'),
    												'tab4'				=>	'',
    												'tab5'				=>	'',
    												'tab6'				=>	$this->lang->line('pb'),
                                                    'tab6_link'			=>	$this->config->item('job_pb'),
												    'tab6_active'		=>	$this->config->item('empty'),
    												'tab7'				=>	'',
    												'tab8'				=>	''
    											 )			
    					 );
    		$this->load->vars($data);
    		$this->load->theme('default');
        else:
            redirect($this->config->item('job'));
        endif;    
	}
    
    function editjob($id)
	{
	    /*if($this->session->userdata('user_group')!= $this->config->item('admin') ){
            redirect($this->config->item('job'));
        }*/
       if(($this->session->userdata('user_pos')== $this->config->item('ta')) || ($this->session->userdata('user_pos')== $this->config->item('ae')) || ( $this->config->item('se') == $this->session->userdata('user_pos') ) || ($this->session->userdata('user_group')== $this->config->item('admin') )  || ($this->session->userdata('user_group')== $this->config->item('co_admin') ) ):
           	
            if(!$id){
                $this->session->set_flashdata('message','<span class="message error"><strong>Error</strong>message - '.$this->lang->line('m_wrong').'  </span>');    
                redirect($this->config->item('job'));
            }
               
    		$data = array(
    						'title'		=>	$this->lang->line('edit').' '.$id,
    						'table'		=>	array(
                                                    'value'				=>	$this->jobs->getData($id),
                                                    'products'			=>	$this->products->getActive(),
                                                    'banks'		       	=>	$this->banks->getActive(),
                                                    'facilitas'		    =>	$this->facilitas->getActive(),
                                                    'participants'      =>  $this->participants->getActive(),
                                                    'fac'				=>	$this->jobs->getJobFac($id),
                                                    'par'				=>	$this->jobs->getJobParticipant($id),
    												'customers'         =>  $this->jobs->getCustomer()
    											 ),
                            'form'      =>  array('action'=>$this->config->item('job_update')),                     
    						'content'	=> 	'form',
    						'menu' 		=> 	array(
    												'dashboard_active'	=>	$this->config->item('empty'),
    												'contact_active'	=>	$this->config->item('empty'),
    												'contactdna_active'	=>	$this->config->item('empty'),
                                                    'activity_active'	=>	$this->config->item('empty'),
    												'job_active'		=>	$this->config->item('active'),
    												'call_active'		=>	$this->config->item('empty'),
    												'user_active'		=>	$this->config->item('empty'),
    												'report_active'		=>	$this->config->item('empty'),
    												'master_active'		=>	$this->config->item('empty'),
    												'graphic_active'	=>	$this->config->item('empty'),
    												'setting_active'	=>	$this->config->item('empty'),
    											 ),
    						'tab'		=>	array(
    												'tab1'				=>	$this->lang->line('list'),
    												'tab1_link'			=>	$this->config->item('job'),
    												'tab1_active'		=>	$this->config->item('empty'),
    												'tab2'				=>	$this->lang->line('add'),
    												'tab2_link'			=>	$this->config->item('job_add'),
    												'tab2_active'		=>	$this->config->item('empty'),
    												'tab3'				=>	$this->lang->line('edit'),
                                                    'tab3_link'			=>	$this->config->item('job_edit').$id,
    												'tab3_active'		=>	$this->config->item('active'),
    												'tab4'				=>	'',
    												'tab5'				=>	'',
    												'tab6'				=>	$this->lang->line('pb'),
                                                    'tab6_link'			=>	$this->config->item('job_pb'),
												    'tab6_active'		=>	$this->config->item('empty'),
    												'tab7'				=>	'',
    												'tab8'				=>	''
    											 )			
    					 );
    		$this->load->vars($data);
    		$this->load->theme('default');
        else:
            redirect($this->config->item('job'));
        endif;    
	}

	function updatejob(){
        /*if($this->session->userdata('user_group')!= $this->config->item('admin') ){
            redirect($this->config->item('job'));
        }*/
        if(($this->session->userdata('user_pos')== $this->config->item('ta')) || ($this->session->userdata('user_pos')== $this->config->item('ae')) || ( $this->config->item('se') == $this->session->userdata('user_pos') ) || ($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') )  ):
          
            if($this->input->post('save')):
                    $this->jobs->getUpdate();
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            endif;
        else:
            redirect($this->config->item('job'));
        endif;        
    }
    
     function deletejob($id){
        if($this->session->userdata('user_group')!= $this->config->item('admin') ){
            redirect($this->config->item('job'));
        }
        if(($this->session->userdata('user_pos')== $this->config->item('ta')) || ($this->session->userdata('user_pos')== $this->config->item('ae')) || ( $this->config->item('se') == $this->session->userdata('user_pos') ) || ($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') )  ):
            $this->jobs->getRemove($id);
            $this->session->set_flashdata('message','<span class="message success"><strong>Succes </strong>message - '.$this->lang->line('m_delete').'  </span>');
            redirect($this->input->server('HTTP_REFERER'));
        else:
            redirect($this->config->item('job'));
        endif;
    }
	
	function searchjob()
	{
	    if( ($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') )  ):
            
           
    		if(($this->session->userdata('user_group')== $this->config->item('admin')) || ($this->session->userdata('user_group')== $this->config->item('co_admin')) ):
                $add 				= $this->lang->line('add');
    			$adv_search 		= $this->lang->line('adv_search');
    			$add_link 			= $this->config->item('job_add');
    			$adv_search_link    = $this->config->item('job_search');
    			$add_active 		= $this->config->item('empty');
    			$adv_search_active  = $this->config->item('active');
                
                $target             = $this->lang->line('target');
                $target_link 	    = $this->config->item('job_target');
                $target_active      = $this->config->item('empty');
                
            else:
                $add 		        = ""; 
    			$add_link 	        = "";
    			$add_active	        = "";
    			
    			$adv_search     	= ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";
                
                $target             = "";
                $target_link 	    = "";
                $target_active      = "";
            endif;
            
            if($this->session->userdata('user_pos')== $this->config->item('ta')):
                        $access = $this->config->item('ta');
            elseif($this->session->userdata('user_pos')== $this->config->item('se')):
                        $access = $this->config->item('se');
            else:
                        $access = "";               
            endif;      
    		
    		$data = array(
                            'title'		=>	$this->lang->line('adv_search'),
                            'table'     =>  array
                                                 (
                                                    'jobs'              =>  $this->jobs->getSearch(),
                                                    'users'			    =>	$this->jobs->getAllUsers()
                                                 ),
    						'form'      =>  array('action'=>$this->config->item('job_search')),	
                            'access'    =>  $access,				 
    						'content'	=> 	'list',
    						'menu' 		=> 	array(
    												'dashboard_active'	=>	$this->config->item('empty'),
    												'contact_active'	=>	$this->config->item('empty'),
    												'contactdna_active'	=>	$this->config->item('empty'),
                                                    'activity_active'	=>	$this->config->item('empty'),
    												'job_active'		=>	$this->config->item('active'),
    												'call_active'		=>	$this->config->item('empty'),
    												'user_active'		=>	$this->config->item('empty'),
    												'report_active'		=>	$this->config->item('empty'),
    												'master_active'		=>	$this->config->item('empty'),
    												'graphic_active'	=>	$this->config->item('empty'),
    												'setting_active'	=>	$this->config->item('empty'),
    											 ),
    						'tab'		=>	array(
    												'tab1'				=>	$this->lang->line('list'),
    												'tab1_link'			=>	$this->config->item('job'),
    												'tab1_active'		=>	$this->config->item('empty'),
                                                    'tab2'				=>	$add,
    												'tab2_link'			=>	$add_link,
    												'tab2_active'		=>	$add_active,
                                                    'tab3'				=>	$adv_search,
    												'tab3_link'			=>	$adv_search_link,
    												'tab3_active'		=>	$adv_search_active,
    												'tab4'				=>	$target,
                                                    'tab4_link'			=>	$target_link,
    												'tab4_active'		=>	$target_active,
    												'tab5'				=>	'',
    												'tab6'				=>	$this->lang->line('pb'),
                                                    'tab6_link'			=>	$this->config->item('job_pb'),
    								                'tab6_active'		=>	$this->config->item('empty'),
    												'tab7'				=>	'',
    												'tab8'				=>	''
    											 )				
    					 );
    		$this->load->vars($data);
    		$this->load->theme('default');
        else:
            redirect($this->config->item('job'));
        endif;    
	}
    
    function approval(){
        if(($this->session->userdata('user_pos')== $this->config->item('spv')) || ($this->config->item('mgr') == $this->session->userdata('user_pos') )|| ($this->config->item('keu')==$this->session->userdata('user_pos') ) || ($this->config->item('prod')==$this->session->userdata('user_group') )  ):
             
    		if($this->session->userdata('user_group')== $this->config->item('admin')):
                $add 				= $this->lang->line('add');
    			$adv_search 		= $this->lang->line('adv_search');
    			$add_link 			= $this->config->item('job_add');
    			$adv_search_link    = $this->config->item('job_search');
    			$add_active 		= $this->config->item('empty');
    			$adv_search_active  = $this->config->item('empty');
                
                $app 		        = $this->lang->line('app');
                $app_link 			= $this->config->item('job_app');
                $app_active 		= $this->config->item('active');
            elseif(($this->session->userdata('user_pos')== $this->config->item('spv'))|| ($this->session->userdata('user_pos')== $this->config->item('mgr')) || ($this->session->userdata('user_pos')== $this->config->item('keu'))):
                $add 		        = ""; 
    			$add_link 	        = "";
    			$add_active	        = "";
                
                $app 		        = $this->lang->line('app');
                $app_link 			= $this->config->item('job_app');
                $app_active 		= $this->config->item('active'); 
                
                $adv_search 		= ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";
            elseif(($this->session->userdata('user_pos')== ($this->config->item('ta')) || ($this->config->item('se') == $this->session->userdata('user_pos')  ) ) ):
                $add 		        = $this->lang->line('add'); 
    			$add_link 	        = $this->config->item('job_add');
    			$add_active	        = $this->config->item('empty');
                
                $app 		        = "";
                $app_link 			= "";
                $app_active 		= ""; 
                
                $adv_search 		= ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";
                
                $target             = "";
                $target_link 	    = "";
                $target_active      = "";   
             elseif(($this->session->userdata('user_group')== $this->config->item('prod'))):
                $add 		        = ""; 
    			$add_link 	        = "";
    			$add_active	        = "";
                
                $app 		        = $this->lang->line('pb');
                $app_link 			= $this->config->item('job_app');
                $app_active 		= $this->config->item('active'); 
                
                $adv_search 		= ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";          
            else:
                $add 		        = ""; 
    			$add_link 	        = "";
    			$add_active	        = "";
    			
    			$adv_search		    = ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";
                
                $app 		        = ""; 
    			$app_link 	        = "";
    			$app_active	        = "";
                
            endif;
            
            if($this->session->userdata('user_pos')== $this->config->item('ta')):
                        $access = $this->config->item('ta');
            elseif($this->session->userdata('user_pos')== $this->config->item('se')):
                        $access = $this->config->item('se');
            else:
                        $access = "";               
            endif;
            
            if($this->session->userdata('user_pos')== $this->config->item('spv')):
                $approval=$this->config->item('spv');
            elseif ($this->session->userdata('user_pos')== $this->config->item('mgr') ):
                $approval=$this->config->item('mgr');
            elseif ($this->session->userdata('user_pos')== $this->config->item('keu') ):
                $approval=$this->config->item('keu');
            elseif ($this->session->userdata('user_group')== $this->config->item('prod') ):
                $approval=$this->config->item('prod');               
    		endif;
            
            if(($this->session->userdata('user_group')== $this->config->item('prod'))):
                $jobs   =   $this->jobs->getApprovalByProduction();
            else:
                $jobs   =   $this->jobs->getApproval();
            endif;
            
    		$data = array(
                            'title'		=>	$this->lang->line('app'),
                            'table'     =>  array
                                                 (
                                                    'jobs'              =>  $jobs
                                                 ),
                            'access'    =>  $access,                     
    						'content'	=> 	'list',
                            'app'       =>  $approval,
    						'menu' 		=> 	array(
    												'dashboard_active'	=>	$this->config->item('empty'),
    												'contact_active'	=>	$this->config->item('empty'),
    												'contactdna_active'	=>	$this->config->item('empty'),
                                                    'activity_active'	=>	$this->config->item('empty'),
    												'job_active'		=>	$this->config->item('active'),
    												'call_active'		=>	$this->config->item('empty'),
    												'user_active'		=>	$this->config->item('empty'),
    												'report_active'		=>	$this->config->item('empty'),
    												'master_active'		=>	$this->config->item('empty'),
    												'graphic_active'	=>	$this->config->item('empty'),
    												'setting_active'	=>	$this->config->item('empty'),
    											 ),
    						'tab'		=>	array(
    												'tab1'				=>	$this->lang->line('list'),
    												'tab1_link'			=>	$this->config->item('job'),
    												'tab1_active'		=>	$this->config->item('empty'),
                                                    'tab2'				=>	$add,
    												'tab2_link'			=>	$add_link,
    												'tab2_active'		=>	$add_active,
                                                    'tab3'				=>	$adv_search,
    												'tab3_link'			=>	$adv_search_link,
    												'tab3_active'		=>	$add_active,
    												'tab4'				=>	$app,
                                                    'tab4_link'			=>	$app_link,
    												'tab4_active'		=>	$app_active,
    												'tab5'				=>	'',
    												'tab6'				=>	$this->lang->line('pb'),
                                                    'tab6_link'			=>	$this->config->item('job_pb'),
												    'tab6_active'		=>	$this->config->item('empty'),
    												'tab7'				=>	'',
    												'tab8'				=>	''
    											 )				
    					 );
    		$this->load->vars($data);
    		$this->load->theme('default');
        else:
            redirect($this->config->item('job'));
        endif;      
	}
    
    function approvalupdate($pos,$id){
        //if($this->session->userdata('user_group')!= $this->config->item('admin') ){
        //    redirect($this->config->item('job'));
        //}
        if(($this->session->userdata('user_pos')== $this->config->item('spv')) || ($this->config->item('mgr') == $this->session->userdata('user_pos') )|| ($this->config->item('keu')==$this->session->userdata('user_pos') )  ):
          
            if(($pos <> "") && ($id <> "")):
                    $this->jobs->getUpdateApp($pos,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message3','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalcancel($pos,$id){
        //if($this->session->userdata('user_group')!= $this->config->item('admin') ){
        //    redirect($this->config->item('job'));
        //}
        if(($this->session->userdata('user_pos')== $this->config->item('spv')) || ($this->config->item('mgr') == $this->session->userdata('user_pos') )|| ($this->config->item('keu')==$this->session->userdata('user_pos') )  ):
          
            if(($pos <> "") && ($id <> "")):
                    $this->jobs->getCancelApp($pos,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message3','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }	
     
    function target(){
        if(($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') )  ):
            
    		if( ($this->session->userdata('user_group')== $this->config->item('admin')) || ($this->session->userdata('user_group')== $this->config->item('co_admin')) ):
                $add 				= $this->lang->line('add');
    			$adv_search 		= $this->lang->line('adv_search');
    			$add_link 			= $this->config->item('job_add');
    			$adv_search_link    = $this->config->item('job_search');
    			$add_active 		= $this->config->item('empty');
    			$adv_search_active  = $this->config->item('empty');
                
                $app 		        = "";
                $app_link 			= "";
                $app_active 		= "";
                
                $target             = $this->lang->line('target');
                $target_link 	    = $this->config->item('job_target');
                $target_active      = $this->config->item('active');
                
           //elseif(($this->session->userdata('user_pos')== ($this->config->item('ta')) || ($this->config->item('se') == $this->session->userdata('user_pos')  ) ) ):
           else:
                $add 		        = $this->lang->line('add'); 
    			$add_link 	        = $this->config->item('job_add');
    			$add_active	        = $this->config->item('empty');
                
                $app 		        = "";
                $app_link 			= "";
                $app_active 		= ""; 
                
                $adv_search 		= ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";
                
                $target             = "";
                $target_link 	    = "";
                $target_active      = "";
           endif;     
    		$data = array(
                            'title'		=>	$this->lang->line('job_target'),
                            'table'		=>	array(
    												'jobs'			    =>	$this->jobs->getAll(),
                                                    'users'			    =>	$this->jobs->getAllUsers(),
                                                    'targets'           =>  $this->jobs->getAllTarget(),
                                                    'details'           =>  $this->jobs->getAllTargetDetails()
    											 ),
                                         
    						'content'	=> 	'list_target',
                            'form'      =>  array('jobs'        => $this->config->item('job_target_save'),
                                                  'jobs_user'   => $this->config->item('job_user_save')  
                                                  ),
    						'menu' 		=> 	array(
    												'dashboard_active'	=>	$this->config->item('empty'),
    												'contact_active'	=>	$this->config->item('empty'),
    												'contactdna_active'	=>	$this->config->item('empty'),
                                                    'activity_active'	=>	$this->config->item('empty'),
    												'job_active'		=>	$this->config->item('active'),
    												'user_active'		=>	$this->config->item('empty'),
    												'call_active'		=>	$this->config->item('empty'),
    												'report_active'		=>	$this->config->item('empty'),
    												'master_active'		=>	$this->config->item('empty'),
    												'graphic_active'	=>	$this->config->item('empty'),
    												'setting_active'	=>	$this->config->item('empty'),
    											 ),
    						'tab'		=>	array(
    												'tab1'				=>	$this->lang->line('list'),
        												'tab1_link'			=>	$this->config->item('job'),
        												'tab1_active'		=>	$this->config->item('empty'),
                                                        'tab2'				=>	$add,
        												'tab2_link'			=>	$add_link,
        												'tab2_active'		=>	$add_active,
                                                        'tab3'				=>	$adv_search,
        												'tab3_link'			=>	$adv_search_link,
        												'tab3_active'		=>	$add_active,
        												'tab4'				=>	$app,
                                                        'tab4_link'			=>	$app_link,
        												'tab4_active'		=>	$app_active,
        												'tab5'				=>	$target,
                                                        'tab5_link'			=>	$target_link,
        												'tab5_active'		=>	$target_active,
        												'tab6'				=>	$this->lang->line('pb'),
                                                        'tab6_link'			=>	$this->config->item('job_pb'),
    												    'tab6_active'		=>	$this->config->item('empty'),
        												'tab7'				=>	'',
        												'tab8'				=>	''
    											 )				
    					 );
    		$this->load->vars($data);
    		$this->load->theme('default');
        else:
            redirect($this->config->item('job'));
        endif;
	}
    
    
    
    
    function savetarget(){
        if(($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') )  ):
          
        if($this->input->post('save')):
            $val=count($this->jobs->getTargetCek());
            if($val<1):
                $this->jobs->getTargetSave();
                $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_save').'  </span>');
                redirect($this->input->server('HTTP_REFERER'));
            else:
                $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_duplicate').'  </span>');
                redirect($this->input->server('HTTP_REFERER'));
            endif;
        endif;
        
        else:
            redirect($this->config->item('job'));
        endif;
        
    }
    
    function saveuser(){
        if(($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') )  ):
          
            if($this->input->post('save')):
                $val=count($this->jobs->getTargetUserCek());
                if($val<1):
                    $this->jobs->getTargetUserSave();
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_save').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
                else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_duplicate').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
                endif;
            endif;
        
        else:
            redirect($this->config->item('job'));
        endif;
        
    }
    
    function removeuser($id){
        if(($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') )  ):
          
            $this->jobs->getTargetUserRemove($id);
            $this->session->set_flashdata('message','<span class="message success"><strong>Succes </strong>message - '.$this->lang->line('m_delete').'  </span>');
            redirect($this->input->server('HTTP_REFERER'));
        else:
            redirect($this->config->item('job'));
        endif;
    }
    
    function removetarget($id){
        if(($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') )  ):
          
            $this->jobs->getTargetRemove($id);
            $this->session->set_flashdata('message','<span class="message success"><strong>Succes </strong>message - '.$this->lang->line('m_delete').'  </span>');
            redirect($this->input->server('HTTP_REFERER'));
         else:
            redirect($this->config->item('job'));
         endif;   
        
    }
    
    function edittarget($id){
	    if(($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') )  ):
          
        
            if(!$id){
                $this->session->set_flashdata('message','<span class="message error"><strong>Error</strong>message - '.$this->lang->line('m_wrong').'  </span>');    
                redirect($this->config->item('activity'));
            }
               
    		$data = array(
    						'title'		=>	$this->lang->line('edit').' '.$id,
    						'table'		=>	array(
                                                    'value'				=>	$this->activities->getDataTarget($id),
                                                    'activity'			=>	$this->activities->getAll(),
                                                    'customers'         =>  $this->activities->getCustomer(),
                                                    'type'			    =>	$this->activities->getType(),
    											 ),
                            'form'      =>  array('action'=>$this->config->item('actvtarget_update')),                     
    						'content'	=> 	'form_target',
    						'menu' 		=> 	array(
    												'dashboard_active'	=>	$this->config->item('empty'),
    												'contact_active'	=>	$this->config->item('active'),
    												'contactdna_active'	=>	$this->config->item('empty'),
                                                    'activity_active'	=>	$this->config->item('empty'),
    												'job_active'		=>	$this->config->item('empty'),
    												'call_active'		=>	$this->config->item('empty'),
    												'user_active'		=>	$this->config->item('empty'),
    												'report_active'		=>	$this->config->item('empty'),
    												'master_active'		=>	$this->config->item('empty'),
    												'graphic_active'	=>	$this->config->item('empty'),
    												'setting_active'	=>	$this->config->item('empty'),
    											 ),
                            'tab'		=>	array(
    												'tab1'				=>	$this->lang->line('my_agenda'),
    												'tab1_link'			=>	$this->config->item('activity'),
    												'tab1_active'		=>	$this->config->item('empty'),
                                                    'tab2'				=>	$this->lang->line('add'),
    												'tab2_link'			=>	$this->config->item('actv_add'),
    												'tab2_active'		=>	$this->config->item('empty'),
                                                    'tab4'				=>	'',
    												'tab4_link'			=>	'',
    												'tab4_active'		=>	$this->config->item('empty'),
                                                    'tab5'				=>	$this->lang->line('actv_daily'),
                                                    'tab5_link'			=>	$this->config->item('actv_daily'),
    												'tab5_active'		=>	$this->config->item('empty'),
    												'tab6'				=>	$this->lang->line('actv_weekly'),
                                                    'tab6_link'			=>	$this->config->item('edit_user'),
    												'tab6_active'		=>	$this->config->item('empty'),
    												'tab7'				=>	$this->lang->line('actv_monthly'),
                                                    'tab7_link'			=>	$this->config->item('edit_user'),
    												'tab7_active'		=>	$this->config->item('empty'),
    												'tab3'				=>	$this->lang->line('edittarget'),
                                                    'tab3_link'			=>	$this->config->item('actvtarget_edit').$id,
    												'tab3_active'		=>	$this->config->item('active'),
    												'tab8'				=>	'',
                                                    'tab8_link'			=>	$this->config->item('edit_user'),
    												'tab8_active'		=>	$this->config->item('empty'),
    												'tab9'				=>	'',
                                                    'tab9_link'			=>	$this->config->item('edit_user'),
    												'tab9_active'		=>	$this->config->item('empty'),
    											 )	                     		
    					 );
    		$this->load->vars($data);
    		$this->load->theme('default');
        else:
            redirect($this->config->item('job'));
        endif;    
	}
    
    function updatetarget(){
       if(($this->session->userdata('user_group')== $this->config->item('admin') ) || ($this->session->userdata('user_group')== $this->config->item('co_admin') )  ):
            
            if($this->input->post('save')){
                    $this->activities->getTargetUpdate();
                    $this->session->set_flashdata('message','<span class="message success"><strong>Succes </strong>message - '.$this->lang->line('m_update').'  </span>');                     
                 }
            redirect($this->input->server('HTTP_REFERER')); 
        else:
            redirect($this->config->item('job'));
        endif;  
    } 
    
    function pb(){
        /*if(($this->session->userdata('user_pos')== $this->config->item('spv')) || ($this->config->item('mgr') == $this->session->userdata('user_pos') )|| ($this->config->item('keu')==$this->session->userdata('user_pos') ) || ($this->config->item('prod')==$this->session->userdata('user_group') )  ):
        */     
    		if(($this->session->userdata('user_group')== $this->config->item('admin')) || ($this->session->userdata('user_group')== $this->config->item('co_admin')) ):
                $add 				= $this->lang->line('add');
    			$adv_search 		= $this->lang->line('adv_search');
    			$add_link 			= $this->config->item('job_add');
    			$adv_search_link    = $this->config->item('job_search');
    			$add_active 		= $this->config->item('empty');
    			$adv_search_active  = $this->config->item('empty');
                
                $app 		        = "";
                $app_link 			= "";
                $app_active 		= "";
            elseif(($this->session->userdata('user_pos')== $this->config->item('spv'))|| ($this->session->userdata('user_pos')== $this->config->item('mgr')) || ($this->session->userdata('user_pos')== $this->config->item('keu'))):
                $add 		        = ""; 
    			$add_link 	        = "";
    			$add_active	        = "";
                
                if($this->session->userdata('user_group')== $this->config->item('manage')):  
                $app 		        = $this->lang->line('app');
                $app_link 			= $this->config->item('job_app');
                $app_active 		= $this->config->item('empty');
                else:
                $app 		        = "";
                $app_link 			= "";
                $app_active 		= "";      
                endif;
                
                $adv_search 		= ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";
             elseif(($this->session->userdata('user_pos')== ($this->config->item('ta')) || ($this->config->item('se') == $this->session->userdata('user_pos')  ) ) ):
                $add 		        = $this->lang->line('add'); 
    			$add_link 	        = $this->config->item('job_add');
    			$add_active	        = $this->config->item('empty');
                
                $app 		        = "";
                $app_link 			= "";
                $app_active 		= ""; 
                
                $adv_search 		= ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";
                
                $target             = "";
                $target_link 	    = "";
                $target_active      = "";      
             elseif(($this->session->userdata('user_group')== $this->config->item('prod'))):
                $add 		        = ""; 
    			$add_link 	        = "";
    			$add_active	        = "";
                
                $app 		        = "";
                $app_link 			= "";
                $app_active 		= ""; 
                
                $adv_search 		= ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";          
            else:
                $add 		        = ""; 
    			$add_link 	        = "";
    			$add_active	        = "";
    			
    			$adv_search		    = ""; 
    			$adv_search_link 	= "";
    			$adv_search_active	= "";
                
                $app 		        = ""; 
    			$app_link 	        = "";
    			$app_active	        = "";
                
            endif;
            
            if($this->session->userdata('user_pos')== $this->config->item('ta')):
                        $access = $this->config->item('ta');
            elseif($this->session->userdata('user_pos')== $this->config->item('se')):
                        $access = $this->config->item('se');
            else:
                        $access = "";               
            endif;
            
            if($this->session->userdata('user_pos')== $this->config->item('spv')):
                $approval=$this->config->item('spv');
            elseif ($this->session->userdata('user_pos')== $this->config->item('mgr') ):
                $approval=$this->config->item('mgr');
            elseif ($this->session->userdata('user_pos')== $this->config->item('keu') ):
                $approval=$this->config->item('keu');
            elseif ($this->session->userdata('user_group')== $this->config->item('prod') ):
                $approval=$this->config->item('prod');
            else:
                $approval="";                   
    		endif;
            
            if(($this->session->userdata('user_group')== $this->config->item('prod'))):
                $jobs   =   $this->jobs->getApprovalByProduction();
            else:
                $jobs   =   $this->jobs->getApproval();
            endif;
            
    		$data = array(
                            'title'		=>	$this->lang->line('pb'),
                            'table'     =>  array
                                                 (
                                                    'jobs'              =>  $jobs
                                                 ),
                            'access'    =>  $access,                     
    						'content'	=> 	'list',
                            'app'       =>  $approval,
    						'menu' 		=> 	array(
    												'dashboard_active'	=>	$this->config->item('empty'),
    												'contact_active'	=>	$this->config->item('empty'),
    												'contactdna_active'	=>	$this->config->item('empty'),
                                                    'activity_active'	=>	$this->config->item('empty'),
    												'job_active'		=>	$this->config->item('active'),
    												'call_active'		=>	$this->config->item('empty'),
    												'user_active'		=>	$this->config->item('empty'),
    												'report_active'		=>	$this->config->item('empty'),
    												'master_active'		=>	$this->config->item('empty'),
    												'graphic_active'	=>	$this->config->item('empty'),
    												'setting_active'	=>	$this->config->item('empty'),
    											 ),
    						'tab'		=>	array(
    												'tab1'				=>	$this->lang->line('list'),
    												'tab1_link'			=>	$this->config->item('job'),
    												'tab1_active'		=>	$this->config->item('empty'),
                                                    'tab2'				=>	$add,
    												'tab2_link'			=>	$add_link,
    												'tab2_active'		=>	$add_active,
                                                    'tab3'				=>	$adv_search,
    												'tab3_link'			=>	$adv_search_link,
    												'tab3_active'		=>	$add_active,
    												'tab4'				=>	$app,
                                                    'tab4_link'			=>	$app_link,
    												'tab4_active'		=>	$app_active,
    												'tab5'				=>	'',
    												'tab6'				=>	$this->lang->line('pb'),
                                                    'tab6_link'			=>	$this->config->item('job_pb'),
												    'tab6_active'		=>	$this->config->item('active'),
    												'tab7'				=>	'',
    												'tab8'				=>	''
    											 )				
    					 );
    		$this->load->vars($data);
    		$this->load->theme('default');
        /*
        else:
            redirect($this->config->item('job'));
        endif;
        */      
	}
    
    function approvalJMupdate($group,$id){
        //if($this->session->userdata('user_group')!= $this->config->item('admin') ){
        //    redirect($this->config->item('job'));
        //}
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppJM($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalJMcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppJM($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalCDupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppCD($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalCDcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppCD($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPLupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppPL($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPLcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppPL($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalCIupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppCI($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalCIcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppCI($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalCITEKupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppCITEK($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalCITEKcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppCITEK($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPAupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppPA($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPAcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppPA($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPMupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppPM($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPMcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppPM($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPDJupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppPDJ($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPDJcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppPDJ($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPDupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppPD($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPDcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppPD($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPPupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppPP($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPPcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppPP($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalBTRupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppBTR($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalBTRcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppBTR($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPMSupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppPMS($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalPMScancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppPMS($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalLKupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppLK($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalLKcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppLK($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalBASEupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppBASE($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalBASEcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppBASE($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalBATRAupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppBATRA($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalBATRAcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppBATRA($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalLAPupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppLAP($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalLAPcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppLAP($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalLLPupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppLLP($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalLLPcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppLLP($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalBA2SEupdate($group,$id){
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
          
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getUpdateAppBA2SE($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;
        else:
            redirect($this->config->item('job'));
        endif;    
    }
    
    function approvalBA2SEcancel($group,$id){
        
        if(($this->session->userdata('user_group')== $this->config->item('prod')) ):
    
            if(($group <> "") && ($id <> "")):
                    $this->jobs->getCancelAppBA2SE($group,$id);
                    $this->session->set_flashdata('message','<span class="message success"><strong>Success</strong>message - '.$this->lang->line('m_update').'  </span>');
                    redirect($this->input->server('HTTP_REFERER')); 
            else:
                    $this->session->set_flashdata('message','<span class="message error"><strong>Error </strong>message - '.$this->lang->line('m_wrong').'  </span>');
                    redirect($this->input->server('HTTP_REFERER'));
            endif;        
        else:
            redirect($this->config->item('job'));
        endif;    
    }

	function exceljob($id){
	    $this->load->model('excels');
		$this->excels->reports($id);
	}	

}

/* End of file dashboard.php */
/* Location: ./system/application/modules/matchbox/controllers/dashboard.php */